package org.anyin.gitee.cloud.center.cdms.repository;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.anyin.gitee.cloud.center.cdms.mapper.CsInfoMapper;
import org.anyin.gitee.cloud.center.cdms.model.CsInfo;
import org.anyin.gitee.cloud.center.common.enums.RegisterSourceEnum;
import org.anyin.gitee.cloud.lib.core.enums.DelFlgEnum;
import org.anyin.gitee.cloud.lib.core.web.BaseRepository;
import org.springframework.stereotype.Repository;

@Repository
public class CsInfoRepository extends BaseRepository<CsInfoMapper, CsInfo> {

    public CsInfo infoByMobile(String mobile){
        QueryWrapper<CsInfo> wrapper = new QueryWrapper<>();
        wrapper.eq("mobile", mobile);
        return baseMapper.selectOne(wrapper);
    }

    public Long create(String mobile, String registerSource){
        CsInfo model = new CsInfo();
        model.setMobile(mobile);
        model.setRegisterSource(registerSource);
        baseMapper.insert(model);
        return model.getId();
    }

}
